<template>
  <el-table-column
    v-if="show"
    :key="code"
    :label="name"
    :width="width"
    align="center"
  >
    <template #default="scope">
      <span>{{ scope.row[code] }}</span>
    </template>
  </el-table-column>
</template>

<script>
// import IkTableId from "@/components/ik/table/input/IkTableId/index.vue"

export default {
  name: 'IkColumnId',
  // components: { IkTableId },
  model: {
    // 属性
    prop: 'value',
    // 事件
    event: 'input'
  },
  props: {
    show: {
      type: Boolean,
      default: false
    },
    code: {
      type: String,
      default: ''
    },
    name: {
      type: String,
      default: ''
    },
    line: {
      type: Number,
      default: 0
    },
    value: {
      type: Number,
      default: 0
    },
    edit: {
      type: Boolean,
      default: true
    },
    defaultValue: {
      type: Number,
      default: 0
    },
    disabled: {
      type: Boolean,
      default: false
    },
    require: {
      type: Boolean,
      default: false
    },
    width: {
      type: String,
      default: "1"
    },
    rules: {
      type: Array,
      default: function() {
        return []
      }
    }
  },
  data() {
    return {
      errorSign: [],
      message: []
    }
  },
  computed: {
    getRequire() {
      return this.require
    }
  },
  methods: {
    onFieldChange(line, code, oldValue, value, errorSign, message) {
      this.$set(this.errorSign, line, errorSign)
      this.$set(this.message, line, message)
      this.$emit('onFieldChange', line, code, oldValue, value, errorSign, message)
    }
  }
}
</script>
<style scoped>
::v-deep.require > .el-input__inner {
  border: red 1px solid;
}
</style>
<style lang="scss">
.el-form-item {
  margin-bottom: 12px;
  width: 100%;
}

.el-form-item__label {
  width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.el-form-item__content {
  width: calc(100% - 180px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
</style>
